<!-- Sofija Puric 6/08 -->
<?php
require '../pages/db.php';
$con=dbConnect("sib");

echo '

<div class="announce">
<div class="title"><p>Number of hostels in database:</p></div>';
                      
$sql = "SELECT COUNT(*) AS Number_hostels FROM hostel";
$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());
$row = mysql_fetch_array($result);
$num = $row["Number_hostels"];
                      echo '<div class="data">'.$num.' hostels in database. </div>
                    </div>



<div class="announce">
                      <div class="title">
                      <p>Number of events:</p></div>';

$sql = "SELECT COUNT(*) AS Number_events FROM event";
$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());
$row = mysql_fetch_array($result);
$num = $row["Number_events"];
                      echo '<div class="data">'.$num.' events in database. </div>
</div>



<div class="announce">
                      <div class="title">
                      <p>Number of members:</p></div>';

$sql = "SELECT COUNT(*) AS Number_members FROM user";
$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());
$row = mysql_fetch_array($result);
$num = $row["Number_members"];
                      echo '<div class="data">'.$num.' members in database. </div>
                    </div>

<div class="announce">
                      <div class="title">
                      <p>Number of reservations:</p></div>';

$sql = "SELECT COUNT(*) AS Number_reservations FROM reservation";
$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());
$row = mysql_fetch_array($result);
$num = $row["Number_reservations"];

$sql = "SELECT COUNT(*) AS Number_reservations_pending FROM reservation WHERE Status = 'Pending'";
$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());
$row = mysql_fetch_array($result);
$num_pending = $row["Number_reservations_pending"];


$sql = "SELECT COUNT(*) AS Number_reservations_accepted FROM reservation WHERE Status = 'Accepted'";
$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());
$row = mysql_fetch_array($result);
$num_accepted = $row["Number_reservations_accepted"];


$sql = "SELECT COUNT(*) AS Number_reservations_denied FROM reservation WHERE Status = 'Denied'";
$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());
$row = mysql_fetch_array($result);
$num_denied = $row["Number_reservations_denied"];
                      echo '<div class="data">'.$num.' reservations in database: '.'</br></br>'.$num_pending.' pending reservations,
                          '.'</br>'.$num_accepted.' accepted reservations, '.'</br>'.$num_denied.' denied reservations.</div>
                    </div>';
                   


                     


?>
